<style scoped lang="scss">

</style>

<template>
  <div>
    Child1
    {{ msg }}:{{ num }}

  </div>
</template>

<script>
export default {
  name: "Child1",
  props: {
    msg: {
      type: String,
      default: 'default'
    },
    num: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      myMsg: this.msg + 'my'
    }
  },
  watch: {
    msg(newVal, oldVal) {
      console.log(`msg的信息修改为${newVal}`)
    }
  },
  methods: {
    changeValue() {
      this.myMsg = '子组件新的信息'
    }
  }
}
</script>
